package system

import (
	"net/http"

	"github.com/micro-plat/hydra"
	"github.com/micro-plat/lib4go/errs"
)

//DeleteHandle  删除系统信息数据
func (u *SystemInfoHandler) SecretHandle(ctx hydra.IContext) (r interface{}) {

	ctx.Log().Info("--------更新secret信息数据--------")

	ctx.Log().Info("1.检查必须字段")
	if err := ctx.Request().Check("secret", "id"); err != nil {
		return err
	}

	ctx.Log().Info("2.查询数据")
	input := ctx.Request().GetMap()
	i, err := hydra.C.DB().GetRegularDB().Execute(updateSystemSecret, input)
	if err != nil || i <= 0 {
		return errs.NewErrorf(http.StatusNotExtended, "更新secret数据出错:%+v", err)
	}
	return
}
